Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add getOrder method for dynamic order column support. #179

Closed
wants to merge 2 commits into from

Conversation

YazeedAlsaif
Copy link

feat: Add getOrder method for dynamic order column support.

  • Implemented getOrder() method to fetch order values from dynamically determined columns.
  • Added tests to validate the getOrder() functionality, ensuring it correctly handles different scenarios.
  • Updated PHPDoc for getOrder() to clearly explain the method's behavior and dynamic column determination.

This update allows all models implementing this interface to use getOrder() to retrieve order values, simplifying code by abstracting the column name details.

Example:

$car = Car::first();
$user = User::find(2);

// instead of doing this
echo $car->order . PHP_EOL;
echo $user->order_column . PHP_EOL;

//we can do this:
echo $car->getOrder() . PHP_EOL;
echo $user->getOrder();

I hope you find this update useful.

Thank you for considering this contribution.

- Implemented `getOrder()` method to fetch order value from a dynamically determined column, enhancing flexibility in model configuration.
- Added tests to validate the `getOrder()` functionality.
- Updated PHPDoc for `getOrder()` to clearly explain the method's behavior and its dynamic column determination.

This update ensures that the model can handle varying order columns, catering to different sorting configurations seamlessly.
- Implemented `getOrder()` method to fetch order value from a dynamically determined column, enhancing flexibility in model configuration.
- Added tests to validate the `getOrder()` functionality.
- Updated PHPDoc for `getOrder()` to clearly explain the method's behavior and its dynamic column determination.

This update ensures that the model can handle varying order columns, catering to different sorting configurations seamlessly.
@freekmurze
Copy link
Member

Thanks, but I'm going to pass on this for now. You can add such a function to your model in your own project.

@freekmurze freekmurze closed this Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants